<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>退款</title>
    <meta name="viewport" content="width=device-width, initial-scale=0.75, maximum-scale=1.0, user-scalable=yes, user-scalable=0, minimal-ui">
    <link rel="stylesheet" type="text/css" href="../../js/layer/css/layui.css">
    <link rel="stylesheet" type="text/css" href="../../css/materialdesignicons.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/style.min.css">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
</head>
<body>
<form  class="layui-form">
    <div id="view">

        <div class="row">

            <div class="col-lg-12">
                <div class="card">



                    <!---验证还是走lay-->
                    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">

                        <div class="layui-tab-content" style="padding: 15px;">

                            <!----分步骤表单--->
                            <div class="layui-tab-item layui-show">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label>订单编号</label>
                                        <input type="text" readonly class="form-control" name="order_id"  value="{{d.order_id}}">

                                    </div>

                                    <div class="form-group">
                                        <label>订单金额</label>
                                        <input type="text" readonly class="form-control" name="amount"  value="{{d.amount}}">

                                    </div>

                                    <div class="form-group">
                                        <label>支付状态</label>

                                        {{#  if(d.pay_status == 1){ }}
                                            <input type="text" readonly class="form-control"   value="已支付">
                                        {{# }else if(d.pay_status == 9){ }}
                                            <input type="text" readonly class="form-control"   value="已退款">
                                        {{#  } }}

                                    </div>

                                    <div class="form-group">
                                        <label>备注</label>
                                        <input type="text" class="form-control" name="remark"  value="">
                                    </div>

                                    {{#  if(d.pay_status == 1){ }}
                                    <div class="form-group">
                                        <label lay-on="test-tips-color">退款选项</label>
                                        <div class="clearfix">
                                            <div class="custom-control custom-radio custom-control-inline">
                                                <input checked="" lay-ignore="" type="radio" id="step0--ro--0" name="refund_options" class="custom-control-input" value="0" style="display: inline-block;">  <label class="custom-control-label" for="step0--ro--0">仅退款</label>
                                            </div>
                                            <div class="custom-control custom-radio custom-control-inline">
                                                <input lay-ignore="" type="radio" id="step0--ro--1" name="refund_options" class="custom-control-input" value="1" style="display: inline-block;">  <label class="custom-control-label" for="step0--ro--1">清空会员权益</label>
                                            </div>
                                        </div>


                                    </div>
                                    {{#  } }}


                                </div>
                            </div>


                        </div>

                        {{#  if(d.pay_status == 1){ }}
                        <div class="col-xs-12" id="from-button" style="text-align: center;">
                            <button type="button" class="btn btn-primary" lay-submit lay-filter="onsubmit" data-tabindex="0" id="submitButton">退&nbsp;&nbsp;款</button>
                        </div>
                        {{#  } }}

                    </div>

                </div>
            </div>


        </div>

    </div>
</form>
<script type="text/javascript" src="../../js/layer/layui.js"></script>
<script>
    ready(function() {

        layui.use(['zhanshop','form', 'zhanshopFrom'], function(){
            var form = layui.form;
            var menuId = parent.layui.zhanshop.getParam('_id');
            const IDNAME = parent.layui.zhanshop.table.idName;
            window.schmas = null;
            layui.zhanshop.view(API_ADDRESS+apiUrlTable+'/'+menuId+'?pk'+'='+layui.zhanshop.getParam(IDNAME), '#view', function(data){
                schmas = data;
                layui.zhanshopFrom.render();
                // 表单提交的处理
                //监听提交

                layui.form.on('submit(onsubmit)', function(data){
                    window.submitData = data.field;
                    delete submitData['select'];
                    submitData['_method'] = 'refund';
                    layui.zhanshop.ajax(API_ADDRESS+apiUrlTable+'/'+menuId, 'POST', submitData, {}, function(res){
                        return layui.zhanshop.alert('已退款', 'success', function(){
                            parent.window.location.reload();
                        });
                    },function(xhr){
                        return layui.zhanshop.alert(xhr.responseJSON.msg ? xhr.responseJSON.msg : xhr.statusText, 'danger');
                    }, true, apiFromJson);

                    return false;
                });
            }, 'POST', {'_method': 'detail'});
        });

    });
</script>
</body>
</html>
